//
//  UIView+Additions.m
//  Behing
//
//  Created by Lj on 2017/10/20.
//  Copyright © 2017年 lj. All rights reserved.
//

#import "UIView+Additions.h"

@implementation UIView (Additions)

- (UIViewController *)viewController {
    UIResponder *next = [self nextResponder];
    do {
        if ([next isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)next;
        }
        next = [next nextResponder];
    } while (next != nil);
    return nil;
}

- (BaseViewController *)baseViewController {
    UIResponder *next = [self nextResponder];
    do {
        if ([next isKindOfClass:[BaseViewController class]]) {
            return (BaseViewController *)next;
        }
        next = [next nextResponder];
    } while (next != nil);
    return nil;
}

@end
